
#ifndef _CHANNEL_H
#define _CHANNEL_H
#ifdef _CHANNELVAR
#define CHANNEL_extern 
#else 
#define CHANNEL_extern extern
#endif
typedef enum
{
	EVT_SRC_NONE,
	EVT_SRC_EMERGENCY_OFF,
	EVT_SRC_POWER_OFF,
	EVT_SRC_POWER_ON,
	EVT_SRC_REAR_ON,
	EVT_SRC_REAR_OFF,
	EVT_SRC_REAR_SOURCE_SET,
	EVT_SRC_FRONT_SOURCE_SET,
	EVT_SRC_CAMERA_ON,
	EVT_SRC_CAMERA_OFF,
	EVT_SRC_NAVI_ON,
	EVT_SRC_NAVI_OFF,
	EVT_SRC_DVDP_ON,
	EVT_SRC_DVDP_OFF,
	EVT_SRC_FRONT_VID_SET,
	EVT_SRC_2_6CH_SET,

	EVT_SRC_FRONT_REAR_CHG,
	EVT_TV_START_SCAN

	
}SOURCE_EVT;


typedef enum
{
	Initialize,			// 0
	Wait_Source_Signal_BT,		// 1
	Wait_Source_Signal,		// 2
	Wait_Source_NoSignal,		// 3
	Wait_Source_NoSignal2,		// 4
	Wait_Source_NoSignal3,		// 5
	Idle,				// 6
	VInCHChg_CCFl_Open,	// 7
	Channel_CHG_Mute,		// 8
	Downmix_Change,		// 9
	Downmix_Change1,		// 10
	ModulePowerCtrl,		//11
	AudioPathCtrl,			//12
	VideoPathCtrl,			//13
	CHN_VID_IDLE,			//14
	Wait_DTV,			//15
	
	CHN_VID_CHG,			//16
	CHN_VID_ACK,			//17
	CHN_VID_MUTE,			//18
	CHN_VID_CDC,			//19
	AudioChangePro,			//20
	AudioVolumeRecover,		//21
	WaitVideoAudioReady,		//22
	WaitPowerOff,			//23
	WaitPowerOn,
	RearSourceChg,			//25
	FrontSourceChg,
	DVDP_PowerOn,			//27
	SettingAspState,
	FrontRearSourceChg,		//29
	TFT_Source_CameraOn_Rear,	//30
	TFT_Source_CameraOn_Front,	//31
	TFT_Source_CameraOn_Signal,	//32
	TFT_Source_CameraOn_NoSignal,
	TFT_Source_CameraOff_Front,	//34
	TFT_Source_CameraOff2,		//35
	TFT_Source_CameraOff_Rear,	//36
	TFT_Source_NaviOn,
	TFT_Source_NaviOff		//38
}MAINSTAT;


typedef struct
{
	unsigned SRC_TUNER_READY	:	1;
	unsigned SRC_DVDP_READY		:	1;
	unsigned SRC_DVDC_READY		:	1;
	unsigned SRC_TV_READY		:	1;
	unsigned					:	1;
	unsigned SRC_VIDEO_READY	:	1;
	unsigned SRC_AUDIO_READY	:	1;
	unsigned SRC_MOVE_READY		:	1;
}_CHANNEL_STATUS;
typedef union
{
	uchar				byte;
	_CHANNEL_STATUS	field;
}CHANNEL_STATUS;


ext    CHANNEL_STATUS ChannelStatus;

#define Channel_Status		ChannelStatus.byte
#define F_TUNER_READY		ChannelStatus.field.SRC_TUNER_READY
#define F_DVDP_READY		ChannelStatus.field.SRC_DVDP_READY
#define F_DVDC_READY		ChannelStatus.field.SRC_DVDC_READY
#define F_TV_READY			ChannelStatus.field.SRC_TV_READY
#define F_VIDEO_READY		ChannelStatus.field.SRC_VIDEO_READY
#define F_AUDIO_READY		ChannelStatus.field.SRC_AUDIO_READY
#define F_MOVE_READY		ChannelStatus.field.SRC_MOVE_READY

#define Set_Tuner_Ack     F_TUNER_READY=1;
#define Clr_Tuner_Ack      F_TUNER_READY=0;

#define Set_Dvdp_Ack      F_DVDP_READY=1;
#define Clr_Dvdp_Ack       F_DVDP_READY=0;

#define Set_Dvdc_Ack      F_DVDC_READY=1;
#define Clr_Dvdc_Ack       F_DVDC_READY=0;

#define Set_TV_Ack         F_TV_READY=1;
#define Clr_TV_Ack          F_TV_READY=0;

#define Set_Video_Ack     F_VIDEO_READY=1;
#define Clr_Video_Ack      F_VIDEO_READY=0;
#define Val_Video_Ack     F_VIDEO_READY

#define Set_Audio_Ack     F_AUDIO_READY=1;
#define Clr_Audio_Ack      F_AUDIO_READY=0;
#define Val_Audio_Ack      F_AUDIO_READY

#define Set_Move_Ack       F_MOVE_READY=1;
#define Clr_Move_Ack        F_MOVE_READY=0;
#define Val_Move_Ack        F_MOVE_READY

ext    uchar channel_record;
ext    MAINSTAT Main_target_state;
ext    uword main_timer;
ext    uchar ASP_setting_sequence;
ext   MAINSTAT	MainStat;
#if IPOD_FUNCTION
extern void Quit_Source(uchar source);
#endif
extern bool ASP_Setting_Again(void);
extern bool Source_SW_Busy();
extern bool SwitchNavi(void);
extern bool BackOffNavi(void);
extern void Special_Source_Pro(void);
extern bool Check_Video_Exist(void);
extern bool Source_Channel_SW(void);
extern  void ChannelProcess(void);
extern  bool Panel_Wait_Signal();
///extern void Set_Mpeg_Channel(void);
////extern bool Source_PowerOn(void);
///extern void TFTDisplay_Change(void);
#endif
